\(\int \sec ^2(e+f x) (a+b \sin ^2(e+f x))^2 \, dx\) [296]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 51 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=-\frac {1}{2} b (4 a+3 b) x+\frac {b^2 \cos (e+f x) \sin (e+f x)}{2 f}+\frac {(a+b)^2 \tan (e+f x)}{f} \]

[Out]

-1/2*b*(4*a+3*b)*x+1/2*b^2*cos(f*x+e)*sin(f*x+e)/f+(a+b)^2*tan(f*x+e)/f

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {3270, 398, 393, 209} \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\frac {(a+b)^2 \tan (e+f x)}{f}-\frac {1}{2} b x (4 a+3 b)+\frac {b^2 \sin (e+f x) \cos (e+f x)}{2 f} \]

[In]

Int[Sec[e + f*x]^2*(a + b*Sin[e + f*x]^2)^2,x]

[Out]

-1/2*(b*(4*a + 3*b)*x) + (b^2*Cos[e + f*x]*Sin[e + f*x])/(2*f) + ((a + b)^2*Tan[e + f*x])/f

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 393

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(-(b*c - a*d))*x*((a + b*x^n)^(p
 + 1)/(a*b*n*(p + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x]
 /; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/n + p, 0])

Rule 398

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Int[PolynomialDivide[(a + b*x^n)
^p, (c + d*x^n)^(-q), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && IGtQ[p, 0] && ILt
Q[q, 0] && GeQ[p, -q]

Rule 3270

Int[cos[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = FreeF
actors[Tan[e + f*x], x]}, Dist[ff/f, Subst[Int[(a + (a + b)*ff^2*x^2)^p/(1 + ff^2*x^2)^(m/2 + p + 1), x], x, T
an[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[m/2] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {\left (a+(a+b) x^2\right )^2}{\left (1+x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {\text {Subst}\left (\int \left ((a+b)^2-\frac {b (2 a+b)+2 b (a+b) x^2}{\left (1+x^2\right )^2}\right ) \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {(a+b)^2 \tan (e+f x)}{f}-\frac {\text {Subst}\left (\int \frac {b (2 a+b)+2 b (a+b) x^2}{\left (1+x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {b^2 \cos (e+f x) \sin (e+f x)}{2 f}+\frac {(a+b)^2 \tan (e+f x)}{f}-\frac {(b (4 a+3 b)) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{2 f} \\ & = -\frac {1}{2} b (4 a+3 b) x+\frac {b^2 \cos (e+f x) \sin (e+f x)}{2 f}+\frac {(a+b)^2 \tan (e+f x)}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.91 (sec) , antiderivative size = 48, normalized size of antiderivative = 0.94 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\frac {-2 b (4 a+3 b) (e+f x)+b^2 \sin (2 (e+f x))+4 (a+b)^2 \tan (e+f x)}{4 f} \]

[In]

Integrate[Sec[e + f*x]^2*(a + b*Sin[e + f*x]^2)^2,x]

[Out]

(-2*b*(4*a + 3*b)*(e + f*x) + b^2*Sin[2*(e + f*x)] + 4*(a + b)^2*Tan[e + f*x])/(4*f)

Maple [A] (verified)

Time = 1.33 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.27

method result size
parallelrisch \(\frac {b^{2} \sin \left (3 f x +3 e \right )-16 b f \left (a +\frac {3 b}{4}\right ) x \cos \left (f x +e \right )+8 \sin \left (f x +e \right ) \left (a^{2}+2 a b +\frac {9}{8} b^{2}\right )}{8 f \cos \left (f x +e \right )}\) \(65\)
derivativedivides \(\frac {a^{2} \tan \left (f x +e \right )+2 a b \left (\tan \left (f x +e \right )-f x -e \right )+b^{2} \left (\frac {\sin ^{5}\left (f x +e \right )}{\cos \left (f x +e \right )}+\left (\sin ^{3}\left (f x +e \right )+\frac {3 \sin \left (f x +e \right )}{2}\right ) \cos \left (f x +e \right )-\frac {3 f x}{2}-\frac {3 e}{2}\right )}{f}\) \(87\)
default \(\frac {a^{2} \tan \left (f x +e \right )+2 a b \left (\tan \left (f x +e \right )-f x -e \right )+b^{2} \left (\frac {\sin ^{5}\left (f x +e \right )}{\cos \left (f x +e \right )}+\left (\sin ^{3}\left (f x +e \right )+\frac {3 \sin \left (f x +e \right )}{2}\right ) \cos \left (f x +e \right )-\frac {3 f x}{2}-\frac {3 e}{2}\right )}{f}\) \(87\)
risch \(-2 a b x -\frac {3 b^{2} x}{2}-\frac {i b^{2} {\mathrm e}^{2 i \left (f x +e \right )}}{8 f}+\frac {i b^{2} {\mathrm e}^{-2 i \left (f x +e \right )}}{8 f}+\frac {2 i a^{2}}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {4 i a b}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {2 i b^{2}}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}\) \(114\)
norman \(\frac {\left (2 a b +\frac {3}{2} b^{2}\right ) x +\left (-6 a b -\frac {9}{2} b^{2}\right ) x \left (\tan ^{8}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (-2 a b -\frac {3}{2} b^{2}\right ) x \left (\tan ^{10}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (6 a b +\frac {9}{2} b^{2}\right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (-4 a b -3 b^{2}\right ) x \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (4 a b +3 b^{2}\right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {8 \left (a^{2}+2 a b +b^{2}\right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {8 \left (a^{2}+2 a b +b^{2}\right ) \left (\tan ^{7}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {\left (2 a^{2}+4 a b +3 b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}-\frac {\left (2 a^{2}+4 a b +3 b^{2}\right ) \left (\tan ^{9}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {2 \left (6 a^{2}+12 a b +5 b^{2}\right ) \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}}{\left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) \left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{4}}\) \(305\)

[In]

int(sec(f*x+e)^2*(a+b*sin(f*x+e)^2)^2,x,method=_RETURNVERBOSE)

[Out]

1/8*(b^2*sin(3*f*x+3*e)-16*b*f*(a+3/4*b)*x*cos(f*x+e)+8*sin(f*x+e)*(a^2+2*a*b+9/8*b^2))/f/cos(f*x+e)

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 68, normalized size of antiderivative = 1.33 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=-\frac {{\left (4 \, a b + 3 \, b^{2}\right )} f x \cos \left (f x + e\right ) - {\left (b^{2} \cos \left (f x + e\right )^{2} + 2 \, a^{2} + 4 \, a b + 2 \, b^{2}\right )} \sin \left (f x + e\right )}{2 \, f \cos \left (f x + e\right )} \]

[In]

integrate(sec(f*x+e)^2*(a+b*sin(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

-1/2*((4*a*b + 3*b^2)*f*x*cos(f*x + e) - (b^2*cos(f*x + e)^2 + 2*a^2 + 4*a*b + 2*b^2)*sin(f*x + e))/(f*cos(f*x
 + e))

Sympy [F]

\[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\int \left (a + b \sin ^{2}{\left (e + f x \right )}\right )^{2} \sec ^{2}{\left (e + f x \right )}\, dx \]

[In]

integrate(sec(f*x+e)**2*(a+b*sin(f*x+e)**2)**2,x)

[Out]

Integral((a + b*sin(e + f*x)**2)**2*sec(e + f*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.33 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.45 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=-\frac {4 \, {\left (f x + e - \tan \left (f x + e\right )\right )} a b + {\left (3 \, f x + 3 \, e - \frac {\tan \left (f x + e\right )}{\tan \left (f x + e\right )^{2} + 1} - 2 \, \tan \left (f x + e\right )\right )} b^{2} - 2 \, a^{2} \tan \left (f x + e\right )}{2 \, f} \]

[In]

integrate(sec(f*x+e)^2*(a+b*sin(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

-1/2*(4*(f*x + e - tan(f*x + e))*a*b + (3*f*x + 3*e - tan(f*x + e)/(tan(f*x + e)^2 + 1) - 2*tan(f*x + e))*b^2
- 2*a^2*tan(f*x + e))/f

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.51 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\frac {2 \, a^{2} \tan \left (f x + e\right ) + 4 \, a b \tan \left (f x + e\right ) + 2 \, b^{2} \tan \left (f x + e\right ) - {\left (4 \, a b + 3 \, b^{2}\right )} {\left (f x + e\right )} + \frac {b^{2} \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{2} + 1}}{2 \, f} \]

[In]

integrate(sec(f*x+e)^2*(a+b*sin(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/2*(2*a^2*tan(f*x + e) + 4*a*b*tan(f*x + e) + 2*b^2*tan(f*x + e) - (4*a*b + 3*b^2)*(f*x + e) + b^2*tan(f*x +
e)/(tan(f*x + e)^2 + 1))/f

Mupad [B] (verification not implemented)

Time = 13.84 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.45 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\frac {\mathrm {tan}\left (e+f\,x\right )\,{\left (a+b\right )}^2}{f}+\frac {b^2\,\sin \left (2\,e+2\,f\,x\right )}{4\,f}-\frac {b\,\mathrm {atan}\left (\frac {b\,\mathrm {tan}\left (e+f\,x\right )\,\left (4\,a+3\,b\right )}{2\,\left (\frac {3\,b^2}{2}+2\,a\,b\right )}\right )\,\left (4\,a+3\,b\right )}{2\,f} \]

[In]

int((a + b*sin(e + f*x)^2)^2/cos(e + f*x)^2,x)

[Out]

(tan(e + f*x)*(a + b)^2)/f + (b^2*sin(2*e + 2*f*x))/(4*f) - (b*atan((b*tan(e + f*x)*(4*a + 3*b))/(2*(2*a*b + (
3*b^2)/2)))*(4*a + 3*b))/(2*f)